package com.bt.dmdb.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "LOGIN_ROLE")
@SuppressWarnings("serial")
public class Role implements java.io.Serializable {

    private Long id;
    private String name;
    private Set<LoginUser> loginUsers = new HashSet<LoginUser>(0);

    public Role() {
    }
    public Role(Long id, String name) {
        this.id = id;
        this.name = name;
       
    }

    public Role(Long id, String name, Set<LoginUser> loginUsers) {
        this.id = id;
        this.name = name;
        this.loginUsers = loginUsers;
    }

    @Id
    @Column(name = "ID", unique = true, nullable = false, precision = 10, scale = 0)
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "NAME", nullable = false, length = 50)
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }
    
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "role", cascade = CascadeType.ALL)
	public Set<LoginUser> getLoginUsers() {
		return loginUsers;
	}

	public void setLoginUsers(Set<LoginUser> loginUsers) {
		this.loginUsers = loginUsers;
	}

 
}
